﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Benchmark.Db.Base.DataObjects;

namespace Benchmark.Db.Base.Connection
{
    public static class Loader
    {
        public static IDbBenchmarkConnectionV1[] GetConnectors()
        {
            try
            {
                List<Type> types = TypeHelper.GetTypesInFolder(typeof(IDbBenchmarkConnectionV1), "*");

                List<IDbBenchmarkConnectionV1> connections = new List<IDbBenchmarkConnectionV1>();

                foreach (Type type in types)
                {
                    object connector = Activator.CreateInstance(type);
                    connections.Add(connector as IDbBenchmarkConnectionV1);
                }

                return connections.ToArray();
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        //where T : class, IDataObject, new()
    }
}
